package org.example.libraryhelper;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;

public class LoginLib extends Activity {
	 private SharedPreferences sp; 
	/* (non-Javadoc)
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.login_lib);
		sp = getSharedPreferences("Setting_himi", MODE_PRIVATE); 
		
		String loginId= sp.getString("loginid", "aa");
		String passwd = sp.getString("passwd", "bb");
		
		Button btnLogin= (Button)findViewById(R.id.btnLogin);		
		Button btnRestore=(Button)findViewById(R.id.btnRestore);
		
		final EditText etLoginId=(EditText)findViewById(R.id.etLoginId);
		final EditText etPasswd=(EditText)findViewById(R.id.etPasswd);
		
		etLoginId.setText(loginId);
		etPasswd.setText(passwd);
		
		btnLogin.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub			
				sp.edit().putString("loginid", etLoginId.getText().toString())
					.putString("passwd", etPasswd.getText().toString())
					.commit();
				setResult(911);
				finish();
			}
		});
		super.onCreate(savedInstanceState);
	}
	

}
